package com.ruoyi.controller;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MessageController {
 
    @Autowired
    private RocketMQTemplate rocketMQTemplate;//注入Mq
 
    /**
     * @Description: 生产rocket消息 
     * @author syc
     * @date: 2022年7月25日 下午4:16:57
     */
    @RequestMapping(value = "/CreateProduct",method = RequestMethod.GET)
    public String  createProduct(String s) {
        //添加信息
        rocketMQTemplate.convertAndSend("first_topic","添加信息为：==="+s);
        return "添加成功";
    }
}
